package com.zxjbyte.yiyi.framework.common.core.okhttp;

import lombok.AllArgsConstructor;
import lombok.Getter;
import okhttp3.logging.HttpLoggingInterceptor;

/**
 * 日志记录级别
 *
 * @Author zhangxingjia
 * @Date 2024/4/28 10:07
 * @Version: 1.0
 */
@Getter
@AllArgsConstructor
public enum LoggerLevel {

    /** No logs. */
    NONE(HttpLoggingInterceptor.Level.NONE),

    /**
     * Logs request and response lines.
     *
     * Example:
     * ```
     * --> POST /greeting http/1.1 (3-byte body)
     *
     * <-- 200 OK (22ms, 6-byte body)
     * ```
     */
    BASIC(HttpLoggingInterceptor.Level.BASIC),

    /**
     * Logs request and response lines and their respective headers.
     *
     * Example:
     * ```
     * --> POST /greeting http/1.1
     * Host: example.com
     * Content-Type: plain/text
     * Content-Length: 3
     * --> END POST
     *
     * <-- 200 OK (22ms)
     * Content-Type: plain/text
     * Content-Length: 6
     * <-- END HTTP
     * ```
     */
    HEADERS(HttpLoggingInterceptor.Level.HEADERS),

    /**
     * Logs request and response lines and their respective headers and bodies (if present).
     *
     * Example:
     * ```
     * --> POST /greeting http/1.1
     * Host: example.com
     * Content-Type: plain/text
     * Content-Length: 3
     *
     * Hi?
     * --> END POST
     *
     * <-- 200 OK (22ms)
     * Content-Type: plain/text
     * Content-Length: 6
     *
     * Hello!
     * <-- END HTTP
     * ```
     */
    BODY(HttpLoggingInterceptor.Level.BODY);

    private final HttpLoggingInterceptor.Level level;
}
